//
//  DatePickerViewController.m
//  07 Pickers
//
//  Created by willter on 13-1-30.
//  Copyright (c) 2013年 willter. All rights reserved.
//

#import "DatePickerViewController.h"

@interface DatePickerViewController ()

@end

@implementation DatePickerViewController
@synthesize datePicker;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    //[super viewDidLoad];
    NSDate *now = [NSDate date];
    [datePicker setDate:now animated:NO];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)dealloc {
    [datePicker release];
    [super dealloc];
}
- (void)viewDidUnload {
    [self setDatePicker:nil];
    [super viewDidUnload];
}
- (IBAction)buttonPressed:(id)sender {
    NSDate *selected = [datePicker date];
    NSString *message = [[NSString alloc] initWithFormat:@"选中的日期和时间是：%@", selected];
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"系统提示"
                          message:message
                          delegate:nil
                          cancelButtonTitle:@"确定"
                          otherButtonTitles:nil];
    [alert show];
    [alert release];
    [message release];
}
@end
